//
// Created by 原帅 on 2022/10/6.
//

#ifndef R_RCONNETOR_H
#define R_RCONNETOR_H

#include "sys/socket.h"
#include "netinet/in.h"
#include "arpa/inet.h"

#define IP_STR_MAX_SIZE 32

class RConnetor {

protected:
    int sockfd = -1;
    char ipv4str[IP_STR_MAX_SIZE] = {0};
    uint32_t ipv4 = 0;
    int port = -1;
    int type = -1;

    struct sockaddr_in localeaddr ={0};
    struct sockaddr_in serveraddr ={0};

public:
    int getSockfd() const;

    const char *getIpv4Str() const;

    int getIpv4() const;

    int getPort() const;

    int getType() const;

    virtual int doConnect()=0;

};


#endif //R_RCONNETOR_H
